﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using ModuleBase;

namespace HostComputerPlatform.Converters
{
    public class StatusToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is ModuleStatus status)
            {
                switch (status)
                {
                    case ModuleStatus.NotExecuted:
                        return System.Windows.Media.Brushes.Gray; // 未执行：灰色
                    case ModuleStatus.Executing:
                        return System.Windows.Media.Brushes.Orange; // 执行中：橙色
                    case ModuleStatus.Executed:
                        return System.Windows.Media.Brushes.Green; // 执行完成：绿色
                    case ModuleStatus.Failed:
                        return System.Windows.Media.Brushes.Red; // 执行失败：红色
                }
            }
            return System.Windows.Media.Brushes.Gray; // 默认颜色
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}